package com.lfl.listener;

import com.lfl.cache.SessionCache;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 * @program: JavaEE-EFD
 * @description:
 * @author: fengjd
 * @create: 2022-07-28 15:13
 **/
public class MySession implements HttpSessionListener {
    @Override
    public void sessionCreated(HttpSessionEvent httpSessionEvent) {
        HttpSession session = httpSessionEvent.getSession();
        session.setAttribute("empListPageNow",1);

//        将session添加到缓存
        SessionCache.cache.add(session);
    }


    @Override
    public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
        System.out.println("session销毁了....");


    }
}
